package 强化训练;

import java.util.Scanner;

public class day20公共子串计算 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        System.out.println(help(s1,s2));
    }
    private static int help(String s1,String s2){
        int sta = 0;
        int end = 0;
        int maxLen = 0;

        for(int i = 0; i < s1.length();i++){
            for(int j = 0;j < s2.length() ; j++){
                int k = i;
                if(s1.charAt(k) != s2.charAt(j)){
                    continue;
                }else{
                    sta = j;//如果出现了相等位置，此时记录开始位置；
                    end = j;//end递增
                    while(k < s1.length() && end < s2.length() && s1.charAt(k) == s2.charAt(end)){
                        k++;
                        end++;
                    }
                    //循环结束，1与2不等，
                    if(maxLen < (end - sta)){
                        maxLen = end - sta;
                    }
                }
            }
        }
        return maxLen;
    }
}
